﻿using DevExpress.XtraEditors.Repository;
using eFatura.Utility;
using Extensions;
using System;
using System.Data;

namespace eFatura
{
    public partial class Yetkilendirme : XForm
    {
        public Yetkilendirme()
        {
            InitializeComponent();
        }

        private void Cari_Load(object sender, EventArgs e)
        {
            ShowOnlyBar();
            
            gvMaster.Init("GetCari", SirketId, false);
            gvMaster.Columns["nFirmaID"].ColumnEdit = RepositoryManager.Firma;
            gvMaster.SetCaptions("nFirmaID:Nebim Firma", "DepartmanId:Onaylayacak Departman", "KullaniciId:Onaylayacak Kullanıcı");
            gvMaster.Columns["DepartmanId"].ColumnEdit = RepositoryManager.Departman;
            gvMaster.Columns["KullaniciId"].ColumnEdit = RepositoryManager.Kullanici;
            gvMaster.MakeReadOnly("DepartmanId", "KullaniciId");
            gvMaster.MakeColumnInvisible("SirketId","eFatura","PostaKutusu","CariId");

            gvMaster.AddSummary();
            gvMaster.BestFitColumns();

            bbiKaydet.ItemClick += bbiKaydet_ItemClick;
            bbiKaydet.Enabled = isYonetici;
        }

        void bbiKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gvMaster.Update("CariId,DepartmanId,KullaniciId", "Cari");
        }
    }
}
